//
//  YCStatusCellFootView.swift
//  swift微博
//
//  Created by 姚伟聪 on 15/12/22.
//  Copyright © 2015年 姚伟聪. All rights reserved.
//

import UIKit

class YCStatusCellFootView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor(white: 0.9, alpha: 1)
        addUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func addUI(){
    
        addSubview(relayBtn)
        addSubview(commentBtn)
        addSubview(praistBtn)
        addSubview(carveViewOne)
        addSubview(carveViewTwo)
       //平铺子控件
       self.ff_HorizontalTile([relayBtn,commentBtn,praistBtn], insets: UIEdgeInsetsZero)
        
        carveViewOne.ff_AlignHorizontal(type: ff_AlignType.CenterRight, referView: relayBtn, size: nil)
        carveViewTwo.ff_AlignHorizontal(type: ff_AlignType.CenterRight, referView: commentBtn, size: nil)
        
        
    }
    
//    override func layoutSubviews() {
//        
//        super.layoutSubviews()
//        
//        let viewWidth = frame.width / CGFloat(subviews.count)
//        let viewHeight = frame.height
//        
//        for var i = 0;i < subviews.count; i++ {
//        
//            let view = subviews[i]
//            
//            view.frame = CGRectMake(CGFloat(i) * viewWidth, 0, viewWidth, viewHeight)
//            
//        
//        }
//    }
    
    //MARK: - 懒加载
    
    private lazy var relayBtn:UIButton = {
   
        let btn = self.returnButton("timeline_icon_retweet", name: "转发")
        
        return btn
    
    }()
    private lazy var commentBtn:UIButton = {
        
        let btn = self.returnButton("timeline_icon_comment", name: "评论")
        return btn
        
    }()
    private lazy var praistBtn:UIButton = {
        
        let btn = self.returnButton("timeline_icon_unlike", name: "赞")
        return btn
        
    }()
    //分割线1
    private lazy var carveViewOne: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line_highlighted"))
    //分割线2
    private lazy var carveViewTwo: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line_highlighted"))
    
    //返回指定的按钮
    private func returnButton(imageName:String,name:String) ->UIButton {
    
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setTitle(name, forState: UIControlState.Normal)
        btn.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(11)
//        btn.titleLabel?.frame.origin.x += 10
        return btn
        
        
    }
    
}
